<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.ksu.manager.model.User"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>系统登录</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="系统登录">
	<meta http-equiv="description" content="系统登录">
	<script type='text/javascript' src='/sm/pages/js/validator.js'></script>
	
	
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type='text/javascript'>

	   function submitForm(){
	     var form = document.getElementById("loginForm");
	     if(isNull(form.loginName.value)){
	        alert("请输入登录名！");
	        return false;
	     }
	     if(isNull(form.password.value)){
	        alert("请输入登录密码！");
	        return false;
	     }
	     form.submit();
	   }
	</script> 
  </head>
  <body>
      <h1>欢迎使用库存管理系统</h1>
     
      <form id="loginForm" action="/sm/controller/login/logon" method="POST">
          <table >
          <%User user = (User)session.getAttribute("user");
            if(user==null){
           %>
              <tr>
                  <td>登录名：
                  </td>
                  <td>
                  <input type="text" name="loginName" value="" maxlength="50"/>
                  </td>
              </tr>
              <tr>
                  <td>密码：
                  </td>
                  <td>
                  <input type="password" name="password" value="" maxlength="50"/>
                  </td>
              </tr>
              <tr>
                  <td>
                  &nbsp;
                  </td>
                  <td>
                 <input type="button" value="登录" onclick="submitForm();"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="reset" value="重置"/>
                  </td>
              </tr>
              <%}else{%>
              <tr>
                  <td><%=user.getUserName() %>已登录&nbsp;&nbsp;&nbsp;&nbsp;</td>
                  <td><a href="/sm/controller/typeItem/list.html">进入系统</a>&nbsp;&nbsp;&nbsp;&nbsp;</td>
                  <td><a href="/sm/controller/login/logonOut">退出系统</a></td>
              </tr>
              <% } %>
          </table>
      </form>
  </body>
</html>
